# Clase Token
#
# Proyecto Único - Versión 1.0
# Grupo R07:
# Cesar Hernández (06-39724)
# Daniel Valera (07-41725)

class Token
  attr_reader :line, :column, :type, :value
  
  def initialize(line, column)
    @line   = line
    @column = column
    @type   = "Token"
    @value  = ""
  end
  
  def to_s
	if @value.to_s.empty?
		"#{@type} (Línea #{@line}, Columna #{@column})"
	else
		"#{@type} #{@value} (Línea #{@line}, Columna #{@column})"
	end
  end
end

# (1) Declaraciones ####################################################

class TkIsNum < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkIsNum"
  end
end

class TkIsVec < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkIsVec"
  end
end

class TkIsMat < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkIsMat"
  end
end

class TkIsString < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkIsString"
  end
end

class TkIsBool < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkIsBool"
  end
end

class TkIsVar < Token
  def initialize(line, column, value)
    super(line, column)
    @type  = "TkIsVar"
  end
end

# (2) Booleanos, números e identificadores #############################

class TkBool < Token
  def initialize(line, column, value)
    super(line, column)
    @type  = "TkBool"
    @value = value
  end
end

class TkNum < Token
  def initialize(line, column, value)
    super(line, column)
    @type  = "TkNum"
    @value = value
  end
end

class TkId < Token
  def initialize(line, column, value)
    super(line, column)
    @type  = "TkId"
    @value = value
  end
end

class TkString < Token
  def initialize(line, column, value)
    super(line, column)
    @type  = "TkString"
    @value = value[1 ... -1]
  end
end

# (3) Operadores #######################################################

class TkPlus < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkPlus"
  end
end

class TkMinus < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkPlus"
  end
end

class TkMult < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkMult"
  end
end

class TkDiv < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkDiv"
  end
end

class TkMod < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkMod"
  end
end

class TkPower < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkPower"
  end
end

class TkLess < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkLess"
  end
end

class TkGreater < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkGreater"
  end
end

class TkLessEqual < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkLessEqual"
  end
end

class TkGreaterEqual < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkGreaterEqual"
  end
end

class TkEqual < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkEqual"
  end
end

class TkNotEqual < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkNotEqual"
  end
end

class TkDot < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkDot"
  end
end

class TkDollar < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkDollar"
  end
end

class TkAt < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkAt"
  end
end

class TkPrime < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkPrime"
  end
end

class TkAnd < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkAnd"
  end
end

class TkOr < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkOr"
  end
end

class TkNot < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkNot"
  end
end

class TkAssign < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkAssign"
  end
end

# (4) Signos de puntuación y separadores ###############################

class TkComma < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkComma"
  end
end

class TkColon < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkColon"
  end
end

class TkSemiColon < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkSemiColon"
  end
end

class TkOpParen < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkOpParen"
  end
end

class TkClParen < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkClParen"
  end
end

class TkOpBrackets < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkOpBrackets"
  end
end

class TkClBrackets < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkClBrackets"
  end
end

class TkOpBraces < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkOpBraces"
  end
end

class TkClBraces < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkClBraces"
  end
end

# (5) Funciones  #######################################################

class TkZeroes < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkZeroes"
  end
end

class TkRange < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkRange"
  end
end

class TkEye < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkEye"
  end
end

class TkDefine < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkDefine"
  end
end

class TkOf < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkOf"
  end
end

class TkType < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkType"
  end
end

class TkAs < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkAs"
  end
end

class TkReturn < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkReturn"
  end
end

# (6) Instrucciones ####################################################

# Bloques de instrucciones

class TkBegin < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkBegin"
  end
end

class TkEnd < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkEnd"
  end
end

# Selección condicional

class TkIf < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkIf"
  end
end

class TkThen < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkThen"
  end
end

class TkElse < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkElse"
  end
end

# Iteración condicional

class TkWhile < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkWhile"
  end
end

class TkDo < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkDo"
  end
end

# Iteración sobre un vector/matriz

class TkForEach < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkForEach"
  end
end

class TkIn < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkIn"
  end
end

# Lectura y escritura

class TkRead < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkRead"
  end
end

class TkWrite < Token
  def initialize(line, column)
    super(line, column)
    @type  = "TkWrite"
  end
end
